<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>山西煤炭现货公路交易系统客户端</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/bootstrap/css/bootstrap.min.css">
<!-- daterange picker -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/plugins/daterangepicker/daterangepicker-bs3.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/ionicons/css/ionicons.min.css">
<!-- jvectormap -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<!-- Theme style -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/dist/css/skins/_all-skins.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/plugins/datatables/dataTables.bootstrap.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
     folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/dist/css/skins/_all-skins.min.css">
<!-- jQuery 2.1.4 -->
<script src="<s:url value="/resources"/>/adminlte/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="<s:url value="/resources"/>/adminlte/bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="<s:url value="/resources"/>/adminlte/dist/js/app.min.js"></script>
<!-- Select2 -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/plugins/select2/select2.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/dist/css/AdminLTE.min.css">
<!-- InputMask -->
<script src="<s:url value="/resources"/>/adminlte/plugins/input-mask/jquery.inputmask.js"></script>
<script src="<s:url value="/resources"/>/adminlte/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="<s:url value="/resources"/>/adminlte/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<!-- DataTables -->
<script src="<s:url value="/resources"/>/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<s:url value="/resources"/>/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- Select2 -->
<script src="<s:url value="/resources"/>/adminlte/plugins/select2/select2.full.min.js"></script>
<script src="<s:url value="/resources"/>/adminlte/plugins/select2/i18n/zh-CN.js"></script>
<!-- default -->
<script src="<s:url value="/resources"/>/adminlte/default.js"></script>
<script src="<s:url value="/resources"/>/adminlte/default_logistical.js"></script>
<script src="<s:url value="/resources"/>/adminlte/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	 $(function(){  
	   // loadUserInfo();
	    var f = false;
	    if("${type}"=="fayxl"){
	    	f = true;
	    }                   
	    //dataTab("dataTab",f,false,false,true,true,false,"<s:url value="/resources"/>/adminlte/dataTabBootstrapCN.json");
	    loadMenu("${user.roleType}","${menuid}",${menuList});
	    
	 });
	 function clickDate(){
		 var startYear = document.getElementById("startDate").value;
		 if(startYear == ""){
			 alert("对不起，请选择查询日期");
		 	return false;
		 }
		 document.getElementById("form").submit();
	}
</script>
</head>
<body class="skin-blue sidebar-mini">
<div class="wrapper">
<%@ include file="../../header.jsp" %>
<%@ include file="../../sidebar.jsp" %>
<div class="content-wrapper" >
<!-- <iframe src="mtzq_html/classify1.html" name="main" class="iframe" frameborder="0" id="main" width="100%"  scrolling=no></iframe> -->
        <!-- Content Header (Page header) -->
        <div class="content-header">
          <h1>
           交易分析
            <small><c:if test="${type eq 'industry'}"> 交易分行业情况表</c:if>
            </small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="<s:url value="/"/>/index.jsp"><i class="fa fa-dashboard"></i>首页</a></li>
            <li><a href="#" id="location1"></a></li>
            <li class="active" id="location2"></li>
          </ol>
        </div>

        <!-- Main content -->
        <div class="content">
         <!-- 查询条件 -->
         <form action="<s:url value="/"/>/trade/case" method="post" id="form">
         <input type="hidden" value="${type}" name="type"/>
          <div class="box box-success">
            <div class="box-header with-border">
              <h3 class="box-title">查询条件</h3>
              <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                <!-- <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button> -->
              </div>
            </div><!-- /.box-header -->
            <div class="box-body">
              <div class="row">
                <div class="col-md-6">
                 <div class="form-group">
                    <label>日期:</label>
                    <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>
                      </div>
                      <input type="text" style="width:60%;padding-left: 17px;height: 32px;border: 1px solid #d2d6de;"  class="" id="startDate" name="startDate" value="${startDate}" onfocus="WdatePicker({dateFmt:'yyyy/MM'})">
                    </div><!-- /.input group -->
                  </div><!-- /.form group -->
                  
               </div>
                <div class="col-md-6">
                  <div class="form-group">
                  	<label>&nbsp;</label>
                  	 <div class="input-group">
                      <button class="btn btn-primary"  type="button" onclick="clickDate()">查询</button>
                     </div>
                  </div>
                  </div>
                
              </div><!-- /.row -->
            </div><!-- /.box-body -->
            
          </div><!-- /.box -->
          </form>
          
          
        <!-- 数据图 start-->
        <!-- 数据图 end -->
        <div class="box">
                <div class="box-header" style="display:block;text-align: center">
                  <h3 class="box-title">${year}年${date1}月煤炭交易情况表（铁路、分行业）</h3></br>
                  <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                <!-- <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button> -->
              </div>
                </div><!-- /.box-header -->
                <div class="box-tools pull-right" style="padding-right:10px"><small>单位：万吨</small></div>
                <div class="box-body">
                  <table id="dataTab" class="table table-bordered">
		                  <thead>
		                      <tr>
		                        <th rowspan="2" style="text-align:center;vertical-align:middle;">行业</th>
		                        <th colspan="3" style="text-align:center;">${date0}月份</th>
		                        <th colspan="3" style="text-align:center;">${date1}月份</th>
		                        <th rowspan="2" style="text-align:center;vertical-align: middle;">备注</th>
		                      </tr>
		                      <tr>
		                        <th  style="text-align: center">合计</th>
		                        <th  style="text-align: center">日常</th>
		                        <th  style="text-align: center">月度</th>
		                        <th  style="text-align: center">合计</th>
		                        <th  style="text-align: center">日常</th>
		                        <th  style="text-align: center">月度</th>
		                      </tr>
	                    </thead>
                    <tbody>
                    <c:if test="${!empty sumMonth && !empty sumTotal}">
	                     <tr>
	                     	<td>合计</td>
	                     	<td>
                     			<c:set value="0" var="smi" />
                        		<c:forEach  items="${sumMonth}" var="sm"  varStatus="smStatus">
                          			<c:if test="${smStatus.first && sm.shul ne null}">
                          				<c:set value="${sm.shul}" var="smi" />  
                          			</c:if>
                          			<c:if test="${smStatus.last && sm.shul ne null}">
                          				${smi+sm.shul}
                          			</c:if> 
                          			<c:if test="${smStatus.last && sm.shul eq null}">
                          				${smi}
                          			</c:if> 
                          		</c:forEach>&nbsp;
	                     	</td>
	                     	<c:forEach items="${sumMonth}" var="sm">
	                     		<c:if test = "${sm.leix eq '日常' }">
	                     		<td>${sm.shul}</td>
	                     		</c:if>
	                     		<c:if test = "${sm.leix eq '月度' }">
	                     		<td>${sm.shul}</td>
	                     		</c:if>
	                     	</c:forEach>
	                     	<td>
	                     		<c:set value="0" var="sti" />
                        		<c:forEach  items="${sumTotal}" var="sm"  varStatus="stStatus">
                          			<c:if test="${stStatus.first && sm.shul ne null}">
                          				<c:set value="${sm.shul}" var="sti" />  
                          			</c:if>
                          			<c:if test="${stStatus.last && sm.shul ne null}">
                          				${sti+sm.shul}
                          			</c:if> 
                          			<c:if test="${stStatus.last && sm.shul eq null}">
                          				${sti}
                          			</c:if> 
                          		</c:forEach>&nbsp;
	                     	</td>
	                     	<c:forEach items="${sumTotal}" var="sm">
	                     		<c:if test = "${sm.leix eq '日常' }">
	                     		<td>${sm.shul}</td>
	                     		</c:if>
	                     		<c:if test = "${sm.leix eq '月度' }">
	                     		<td>${sm.shul}</td>
	                     		</c:if>
	                     	</c:forEach>
	                     <td>&nbsp;</td>
	                     </tr>
                     </c:if>
                      <c:forEach items="${leftTitle}" var="left">
                      	 <tr>
                      	 	<td>${left.hangy}</td>
                      	 	<td>
                      	 		<c:set value="0" var="myi1" /> 
                      	 		<c:forEach  items="${monthYear}" var="my1" varStatus="myStatus1">
                      	 			<c:if test="${my1.hangy eq left.hangy }">
                          				 <c:set value="1" var="myi1" /> 
                          			</c:if>
                          			
                          			<c:set value="0" var="mdi1" />
                      	 			<c:forEach  items="${monthDaily}" var="md1"  varStatus="mdStatus1">
                      	 				<c:if test="${md1.hangy eq left.hangy && md1.hangy ne null}">
                          					<c:set value="1" var="mdi1" />  
                          				</c:if>
                          				<c:if test="${md1.hangy eq left.hangy && my1.hangy eq left.hangy && mdi1 eq 1 && myi1 eq 1}">
                          					${my1.shul + md1.shul}
                          					<c:set value="2" var="myi1" /> 
                          					<c:set value="2" var="mdi1" /> 
                          				</c:if>
                          				<c:if test="${myStatus1.last && mdi1 eq 1  && myi1 eq 0}">
                          					${md1.shul}
                          					<c:set value="2" var="mdi1" /> 
                          				</c:if>
                          			</c:forEach>
                          			<c:if test="${ mdi1 eq 0  && myi1 eq 1}">
                          					${my1.shul}
                          					<c:set value="2" var="myi1" /> 
                          			</c:if>
                         	 	</c:forEach>&nbsp;
                          	</td>
                          	<td>
                          		<c:set value="0" var="myi" />  
                         		<c:forEach  items="${monthYear}" var="my"  varStatus="myStatus">
                          			<c:if test="${my.hangy eq left.hangy }">
                          				${my.shul}
                          				<c:set value="1" var="myi" />  
                          			</c:if>
                          			<c:if test="${myStatus.last && myi eq 0}">
                          				0
                          			</c:if> 
                          		</c:forEach>&nbsp;
                          	</td>
                        	<td>
                        		<c:set value="0" var="mdi" />
                        		<c:forEach  items="${monthDaily}" var="md"  varStatus="mdStatus">
                          			<c:if test="${md.hangy eq left.hangy && md.hangy ne null}">
                          				${md.shul}
                          				<c:set value="1" var="mdi" />  
                          			</c:if>
                          			<c:if test="${mdStatus.last && mdi eq 0}">
                          				0
                          			</c:if> 
                          		</c:forEach>&nbsp;
                          		
                          	</td>
                          	<td>
                      	 		<c:set value="0" var="tyi1" /> 
                      	 		<c:forEach  items="${totalYear}" var="my1" varStatus="myStatus1">
                      	 			<c:if test="${my1.hangy eq left.hangy }">
                          				 <c:set value="1" var="tyi1" /> 
                          			</c:if>
                          			<c:set value="0" var="tdi1" />
                      	 			<c:forEach  items="${totalDaily}" var="md1"  varStatus="mdStatus1">
                      	 				<c:if test="${md1.hangy eq left.hangy && md1.hangy ne null}">
                          					<c:set value="1" var="tdi1" />  
                          				</c:if>
                          				<c:if test="${md1.hangy eq left.hangy && my1.hangy eq left.hangy && tdi1 eq 1 && tyi1 eq 1}">
                          					${my1.shul + md1.shul}
                          					<c:set value="2" var="tyi1" /> 
                          					<c:set value="2" var="tdi1" /> 
                          				</c:if>
                          				<c:if test="${myStatus1.last && tdi1 eq 1  && tyi1 eq 0}">
                          					${md1.shul}
                          					<c:set value="2" var="tdi1" /> 
                          				</c:if>
                          			</c:forEach>
                          			<c:if test="${ tdi1 eq 0  && tyi1 eq 1}">
                          					${my1.shul}
                          					<c:set value="2" var="tyi1" /> 
                          			</c:if>
                         	 	</c:forEach>&nbsp;
                          	</td>
                          	<td>
                          		<c:set value="0" var="tyi" />  
                         		<c:forEach  items="${totalYear}" var="my"  varStatus="myStatus">
                          			<c:if test="${my.hangy eq left.hangy }">
                          				${my.shul}
                          				<c:set value="1" var="tyi" />  
                          			</c:if>
                          			<c:if test="${myStatus.last && tyi eq 0}">
                          				0
                          			</c:if> 
                          		</c:forEach>&nbsp;
                          	</td>
                        	<td>
                        		<c:set value="0" var="tdi" />
                        		<c:forEach  items="${totalDaily}" var="md"  varStatus="mdStatus">
                          			<c:if test="${md.hangy eq left.hangy && md.hangy ne null}">
                          				${md.shul}
                          				<c:set value="1" var="tdi" />  
                          			</c:if>
                          			<c:if test="${mdStatus.last && tdi eq 0}">
                          				0
                          			</c:if> 
                          		</c:forEach>&nbsp;
                          	</td>
                          	<td>&nbsp;</td>
                        </tr>
                      </c:forEach>
                    </tbody>
                  </table>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
        </div><!-- /.content -->
      </div><!-- /.content-wrapper -->
</div>  
</body>
</html>
